package com.ybkj.chat.ui.dialog;

import android.app.AlertDialog;
import android.content.Context;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;

import com.ybkj.chat.R;

/**
 * @author yyj
 * @create 2019-02-28 10:19
 * @Describe
 */
public class DynamicShareDialog extends AlertDialog {

    private Context mContext;

    public DynamicShareDialog(Context context, int themeResId) {
        super(context, themeResId);
        mContext = context;
    }


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        View view = View.inflate(mContext, R.layout.dialog_dynamic_share, null);
        setContentView(view);

        Window window = this.getWindow();
        window.setGravity(Gravity.BOTTOM);
        window.setWindowAnimations(R.style.choose_item_dialog_animation);

        WindowManager.LayoutParams lp = window.getAttributes();
        DisplayMetrics d = mContext.getResources().getDisplayMetrics();
        lp.width = (int) (d.widthPixels * 1.0);
        window.setAttributes(lp);
    }
}
